<?php

// use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitActivityJoinStat extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 活动参与统计表
        Schema::create('activity_join_stat', function (Blueprint $table) {

            $table->comment = '用户参与活动统计表';

            $table->increments('id');
            $table->uuid('uuid')->index() ;

            $table->integer('user_id')->index()->comment('用户id'); // 标题
            $table->integer('node_id')->index()->comment('活动id'); // 
            $table->uuid('node_uuid')->index()->comment('活动uuid'); // 标题
            $table->char('node_type', 20)->index()->comment('活动类型'); // 标题

            $table->integer('total')->default(0)->index()->comment('参与次数'); // 参与次数表

            $table->integer('paid_money')->default(0)->index()->comment('花费的人民币'); // 参与次数表
            $table->integer('paid_balance')->default(0)->index()->comment('支付的余额总'); // 参与次数表
            $table->integer('paid_score')->default(0)->index()->comment('花费的积分'); // 参与次数表

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('activity_join_stat');
    }
}
